/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/24 23:23
  *
  * @file       pd_spi_hd.h
  * @brief      Header file of SPI peripheral hardware driver.
  *
  * @note       This file contains the SPI object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/24     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_SPI_HD_H
#define JLC_SKY_SPI_HD_H

#include <stm32f407xx.h>
#include "pd_spi.h"
#include "pd_spi_io.h"
#include "drivers.h"

typedef struct SPIHardwareDef SPIHardware;

struct SPIHardwareDef {
    SPI spi;

    SPI_TypeDef *SPIx;

    uint32_t TransferDirection;
    uint32_t Mode;
    uint32_t DataWidth;
    uint32_t ClockPolarity;
    uint32_t ClockPhase;
    uint32_t NSS;
    uint32_t BaudRate;
    uint32_t BitOrder;
    uint32_t CRCCalculation;
    uint32_t CRCPoly;
};

extern const struct SPIHardwareClass {
    SPIHardware *(*build)(SPI_TypeDef *SPIx, SPIGPIO *spiGPIO);
} SPIHardwareBuilder;

#endif //JLC_SKY_SPI_HD_H
